// 引入mockjs
import Mock from 'mockjs'
// 引入所需数据
import loginAPI from './data/login'
import userAPI from './data/user'
import roleAPI from './data/role'
import nodeAPI from './data/node'
import menuAPI from './data/menu'
import departmentAPI from './data/department'
import moduleAPI from './data/module'

// 处理对应路由 Mock.mock( url (可以用正则表达式), post/get , 返回的数据)
Mock.mock(/\/login/, 'post', loginAPI.loginByUsername)
Mock.mock(/\/logout/, 'post', loginAPI.logout)
Mock.mock(/\/user\/info\.*/, 'get', loginAPI.getUserInfo)

// 用户相关
Mock.mock(/\/user\/list\.*/, 'get', userAPI.getUserList)
Mock.mock(/\/user\/roles\.*/, 'get', userAPI.getUserRoles)
Mock.mock(/\/user\/depts\.*/, 'get', userAPI.getUserDepts)
Mock.mock(/\/user\/saveRoles\.*/, 'post', userAPI.saveUserRoles)
Mock.mock(/\/user\/saveDepts\.*/, 'post', userAPI.saveUserDepts)
Mock.mock(/\/user\/del\.*/, 'get', userAPI.userDel)

// 角色相关
Mock.mock(/\/role\/list\.*/, 'get', roleAPI.getRoleList)
Mock.mock(/\/role\/del\.*/, 'get', roleAPI.roleDel)
Mock.mock(/\/role\/add\.*/, 'post', roleAPI.roleAdd)

// 权限相关
Mock.mock(/\/node\/list\.*/, 'get', nodeAPI.getNodeList)
Mock.mock(/\/node\/del\.*/, 'get', nodeAPI.nodeDel)
Mock.mock(/\/node\/add\.*/, 'post', nodeAPI.nodeAdd)

// 菜单相关
Mock.mock(/\/menu\/list\.*/, 'get', menuAPI.getMenuList)
Mock.mock(/\/menu\/del\.*/, 'get', menuAPI.menuDel)
Mock.mock(/\/menu\/add\.*/, 'post', menuAPI.menuAdd)

// 部门相关
Mock.mock(/\/department\/list\.*/, 'get', departmentAPI.getDepartmentList)
Mock.mock(/\/department\/del\.*/, 'get', departmentAPI.departmentDel)
Mock.mock(/\/department\/add\.*/, 'post', departmentAPI.departmentAdd)

// 模块相关
Mock.mock(/\/module\/list\.*/, 'get', moduleAPI.getModuleList)
